Method and device for the exchange of data between at least two users connected to a bus system

ABSTRACT

A method and device for the exchange of data in messages between at least two users which are connected by a bus system and have separate time bases, the messages containing the data being transmitted by the users via the bus system; and a first user, in a function as timer, controls the messages as a function of time in such a way that it repeatedly transmits a reference message, which contains time information regarding the time base of the first user, via the bus at a specifiable time interval; the at least second user forms its own time information, using its time base, as a function of the time information of the first user; a correction value is ascertained from the two pieces of time information; and the second user adapts its time information and/or its time base as a function of the correction value.

FIELD OF THE INVENTION

[0001] The present invention relates to a method and a device for theexchange of data between at least two users (nodes) connected to a bussystem.

BACKGROUND INFORMATION

[0002] As related art in automotive networking, the CAN (controller areanetwork) protocol has been used for several years. In that case, thecommunication is controlled in an event-driven manner. Very great loadscan be produced when the transmission of various messages is to beinitiated at the same time. The non-destructive arbitration mechanism ofCAN guarantees the sequential transmission of all messages according tothe priority of their identifiers or identifications. For hard real-timesystems, an analysis of the transit times and bus loads for the entiresystem must be made in advance, to make sure that all message deadlinescan be observed (even under peak load).

[0003] There are already communication protocols which are based ontime-controlled processing, such as TTP/C or Interbus-S. The exceptionalfeature in this case is that the bus access is already planned inadvance by allocating transmission instants. Thus, no collisions canoccur during the transit time. However, in the same way, a peak load isavoided on the communications bus. Thus, the bus is frequently notcompletely utilized to capacity.

[0004] When working with such time-controlled systems—systems havingdistributed clocks—synchronization mechanisms are necessary and known,such as synchronization to level changes of individual bits, etc.

[0005] Because of this, intervals are frequently necessary betweenindividual messages to compensate for tolerances, thus reducing theefficiency of the bus capacity utilization.

[0006] It is apparent that the related art is unable to deliver optimalresults in every respect.

SUMMARY OF THE INVENTION

[0007] Thus, the present invention includes a method and a device forthe exchange of data in messages between at least two users which areconnected by a bus system and have separate time bases, the messagescontaining the data being transmitted by the users via the bus system;and a first user, in a function as timer, controls the messages as afunction of time in such a way that it repeatedly transmits a referencemessage, which contains time information regarding the time base of thefirst user, via the bus at a specifiable time interval; the at leastsecond user forms its own time information, using its time base, as afunction of the time information of the first user; a correction valueis ascertained from the two pieces of time information; and the seconduser adapts its time information and/or its time base as a function ofthe correction value.

[0008] In this context, the CAN bus is used particularly expediently asthe basic bus system or bus protocol. However, the present inventionrelates generally to any bus system or bus protocol in which anobject-oriented message transfer or data transfer is used, thus themessage and/or the data contained therein are clearly recognizable by anidentifier. Consequently, this is valid for all busses in which not theusers, but rather the messages or their data are addressed, inparticular the CAN bus.

[0009] The messages are advantageously controlled by a first user as afunction of time in such a way that the first user repeatedly transmitsa reference message via the bus at at least one predefinable timeinterval, and the time interval is subdivided into timing windows ofspecifiable length, the messages being transmitted in the timingwindows.

[0010] Therefore, compared to the related art, the present inventionadvantageously includes a higher protocol layer with respect to theactual bus (CAN) protocol which is retained unchanged within theframework of the time-controlled communication according to the presentinvention. Thus, the time-controlled communication advantageously allowsfull capacity utilization of the bus, and at the same time makes itpossible to hold the latency times for each message to a defined value.

[0011] The present invention therefore includes a cyclically proceedingtransfer of bus (CAN) messages. In this manner, a deterministic andcombinable communication system is produced. Such a system issubsequently referred to as TTCAN in the present invention. Furthermore,in the same way, the starting point is a CAN bus, the considerationsbeing valid generally for all bus systems or bus protocols havingobject-oriented message transfer, as mentioned above.

[0012] The reference message and the subsequent timing windows up to thenext reference message are expediently combined to form a first cycle ofspecifiable length and/or specifiable structure, the structurecorresponding to the length, number and time position of the timingwindows in the time interval which follow the reference message.

[0013] Furthermore, a plurality of first cycles of the same structureare advantageously combined to form a second cycle, messages in thesecond cycle also being repeatedly transmitted in timing windows whosetime interval is greater than the time length of the first cycle.

[0014] One cyclical message transfer is expediently omitted in at leastone timing window of the first or the second cycle. In these initiallyempty timing windows, it is then possible to transfer arbitratingmessages, thus such which do not have to be transmitted cyclically, butrather are available when, for example, certain sequences are concluded.

[0015] Each first cycle is advantageously started with a referencemessage, and the at least second user determines an interval of its timebase with respect to the time base of the first user. Consequently, thecorrection value can expediently be ascertained from the difference oftwo intervals of the time bases of the at least two users.

[0016] In this manner, it is advantageously possible to adjust theaccuracy of the local clocks distributed in a TTCAN system, in order tosynchronize transmission instants and reception instants more preciselythan in the related art.

[0017] Another advantage is that, because of this, the clocks in theindividual stations can exhibit a greater tolerance of accuracy (cheapercomponents, particularly oscillators) between the synchronizationintervals.

[0018] Expediently, the first cycles or base cycles (interval betweentwo reference messages) can become greater, resulting in a rise inefficiency of the bus capacity utilization.

[0019] It is also advantageous that the length of a base cycle is nolonger limited by the tolerance of the individual clocks, and that theintervals between the individual messages (so-called inter-frame gaps),necessary in other methods to compensate for tolerances, may be omitted.

BRIEF DESCRIPTION OF THE DRAWINGS

[0020]FIG. 1 shows schematically a bus system having a plurality ofusers.

[0021]FIG. 2 shows the sequence in principle of the first cycles or basecycles and the second cycles, the overall cycles over time.

[0022]FIG. 3 illustrates in detail the design and message occupancy ofthe timing windows.

[0023]FIG. 4 shows an overall cycle having 7 base cycles and diversetransmission groups of messages, as well as arbitrating messages.

[0024]FIG. 5 shows, by analogy with FIG. 1, the correction (driftcorrection) of the local time bases or time information.

[0025]FIG. 6 shows in detail, in the form of a block diagram, an examplefor the drift correction itself. This block diagram can be implementedin hardware and/or software.

DETAILED DESCRIPTION

[0026] TTCAN is based essentially on a time-controlled, periodiccommunication which is clocked by a timer (node, user) with the aid of atime-reference message, or reference message RN for short. The period upto the next reference message RN is denoted as base cycle and issubdivided into n timing windows (see FIG. 2). Each timing window allowsthe exclusive transmission of one periodic message of variable length.These periodic messages are transmitted in a TTCAN controller by usingtiming marks which are coupled to the expiration of a logical relativetime. However, TTCAN also allows the consideration of vacant timingwindows. These timing windows can be used for so-called spontaneousmessages, the access within these timing windows to the bus beingutilized via the arbitration scheme of CAN (arbitrating messages). Thesynchronization of the timer clock (global time gZ) with the internallocal time of individual nodes lZ1 through lZ4 is taken into account andefficiently converted.

[0027]FIG. 1 shows a bus system 100 having a plurality of bus users 101through 105. In this context, each user 101 through 105 has a separatetime base 106 through 110 which can be transmitted, on the one hand, byan internal element such as a clock, counter, clock generator, etc., orexternally to the respective user. The respective local time base lZ1through lZ4 is, in particular, a counter, for example, a 16-bitincrementing counter, which may only be influenced by a HW reset. Inthis instance, the local time base is implemented in each node or user102 through 105. One user, the timer, 101, has an exposed setting. Itstime base is designated as global time base 106 having global time gZ,and is either implemented in timer 101, or is transmitted to itexternally. Global time gZ is formed in principle in each node fromlocal time base 107 through 110, i.e. local time lZ (lZ1 through lZ4)and an offset OS1 through OS4. As a rule, this offset OSg for timer 101is equal to zero (OSg=0). All other nodes form their view of global timegZ from local time lZ (lZ1 through lZ4) and local offset OS1 through OS4and OSg, when OSg≠0. The case when OSg is not zero occurs, for example,when global time gZ is transmitted from the outside to timer 101 which,in addition, contains its own time base 106. Then, the timer is alsocalibrated to global time gZ, and gZ and time base 106 may not agree.The local offset is the difference between the local time at thetransmission instant (SOF, start of frame) of the reference message, andthe global time transmitted by the timer in this reference message.

Local Time Base and the Global Time

[0028] Local Time Base: The local time base is a counter, such as a16-bit incrementing counter, which may only be influenced by a HW reset.The local time base is implemented in each node.

[0029] Reference-Mark Buffer Register: In response to each assumed SOF,the buffer register is loaded with the local time base.

[0030] Reference Marker: If the instantaneous message is recognized as areference message, then the value is retrieved from the buffer registerinto the reference marker (as local reference mark). The referencemarker is configured, for example, as a 16-bit register.

[0031] Timer Reference Mark: This is the reference mark of the timerreceived by the time takers in the reference message.

[0032] Local Offset With Respect To the Global Time: The local offset tothe global time is the difference between the reference mark in thebuffer register and the global timing mark received in the referencemessage. It is used for calculating the global time from the local time.The offset of the timer itself remains constant. The timer transmits itslocal reference mark plus the local offset in the reference message.

[0033] Thus, timer 101 is also that node or user which transmitstime-reference message 111, i.e., reference message RN for short. Arrow112 indicates that reference message RN 111 is dispatched, especiallysimultaneously, to remaining users 102 through 105.

[0034] Reference message RN is the basis for the time-controlled,periodic operation of TTCAN. It is clearly denoted by a specialidentifier, and is received by all nodes, here 102 through 105, as clockgenerator. In principle, it is sent out cyclically by timer 101. Thereference message can include the following data: The number of theinstantaneous base cycle BZn, the reference mark of the timer in globaltime.

[0035] The reference mark is formed by the takeover of the internalcounter reading at the instant of the “start of frame” bit (SOF) uponreception of the reference message of the timer. Thus, the referencemark is an instantaneous recording of the local time base at the instantof receiving the reference message. Relative time RZ1 through RZ4 andRZg specified in the users is the difference between the local time baseand the last reference mark. All definitions with regard to the timingmarks used relate to the relative time of an individual user. Forexample, it can be permanently available as a signal (e.g., by combiningthe two register values via gates). The reference mark determines therelative time of all nodes on the TTCAN bus.

[0036] Watchdog Wg and W1 through W4, likewise shown, is a specialrelative instant. Such a relative instant (watchdog)—at which a newreference message, and thus a reference mark, as well, is expected atthe latest—is defined in each node. Therefore, the watchdog represents aspecial timing mark. The watchdog is used primarily in the initializingand re-initializing to monitor whether a communication has taken placeat all. In this case, the watchdog should always be greater then theinterval between the reference messages.

[0037] In this context, one timing mark is a relative instant whichestablishes the relationship between the relative time and an action inthe original bus (CAN) controller. One timing mark is represented asregister, a controller having the ability to manage a plurality oftiming marks. A plurality of timing marks can be allocated to onemessage (see, for example, in FIG. 4: transmission group A occurs bothin timing window ZF1 a, and in timing window ZF4 a).

[0038] With regard to the application, an application watchdog isactuated in particular. This watchdog is employed regularly by theapplication in order to signal the proper operation to the TTCANcontroller. The messages are sent by the CAN controller only when thiswatchdog is actuated.

[0039]FIG. 2 shows the principle of the time-controlled, periodicmessage or data transfer over time. This message transfer is clocked bythe timer with the aid of the reference message. Time interval t0through t6 is designated as base cycle BZ and is subdivided into ktiming windows (k ε N). Reference messages RN of respective base cyclesBZ0 through BZ3 are transmitted from t0 to t1, t6 to t7, t12 to t13 andt18 to t19, thus in timing window ZFRN. The structure of timing windowsZF1 through ZF5 following a reference message RN, thus their length (insegments S, where Δts=tsb−tsa), their number and their time position, isspecifiable. In this manner, an overall cycle GZ1 which begins at t0 andends at t24, to be run through anew, can be formed from a plurality ofbase cycles of the same structure. For example, the timing windowsinclude 2 to 5 segments having, for instance, 32 bit times each. Thenumber of timing windows is, for example, 2 to 16, only one timingwindow or more than 16 also being possible. The number of base cycles inan overall cycle is 2^(m), for instance, where, in particular m≦4.

[0040] By way of example, tzff1 and tzff2 denote two transmissionenabling intervals or timing-window enabling intervals which, forinstance, last 16 or 32 bit times and describe the time frame withinwhich it is possible to begin with the transmission of the message withrespect to the base cycle.

[0041] Each timing window allows the exclusive transmission of aperiodic message of variable length. By way of example, FIG. 3 shows twomessages of different length and the allocation in the timing window.For instance, message 1 (N1) as block 300 contains 130 bits, and message2 (N2) as block 301 contains 47 bits.

[0042] As already mentioned, maximum and minimum timing windows can bepredefined as a function of the message length, for instance, between 2and 5 segments per timing window in this example. Thus, a maximum timingwindow ZFmax is predefined as block 302 which includes 5 segments (S1through S5) having 32 bit times each, and a minimum timing window ZFminis predefined as block 303 which includes 2 segments (S1 and S2) having32 bit times each. Messages N1 and N2 are transmitted in them, themessages thus not having to completely fill up the timing windows;rather, the timing-window sizes are specified according to the messagelength. Therefore, ZFmax offers sufficient time or place for the longestpossible message, e.g. 130 bits or bit times, and ZFmin can be adaptedto the shortest possible message, e.g. 47 bits.

[0043] In general, the timing window is the time frame available for aspecific message (see FIG. 3). The timing window of a message is openedwith the application of the proceed-to-send signal, and the beginning ofthis window agrees in principle with a defined timing mark. The lengthof the timing window is determined from i segments having, for example,32 bit times (see block 304 a). In this context, the segmenting at, inparticular, 32 bit times represents a HW-friendly size. The timingwindow may not be shorter than the longest message occurring in thistiming window. The bit time is, in particular, the nominal CAN bit time.

[0044] The transmission enabling interval or timing-window enablinginterval describes the time frame within which the transmission of themessage may be started. The transmission enabling interval is a part ofthe timing window. Thus, the proceed-to-send is applied in the intervaltiming mark and timing mark plus delta. The value delta is perceptiblysmaller than the length of the timing window (e.g., 16 or 32 bit timesfor ZFF1 or ZFF2). A message whose beginning does not lie within thetransmission enabling interval may not be sent.

[0045]FIG. 4 now represents an overall cycle (transmission matrix) GZ2.

[0046] Overall Cycle (Transmission Matrix): All messages (RN, A throughF and arbitrating) of all users are organized as components of atransmission matrix (see FIG. 4). The transmission matrix is made up ofindividual base cycles BZ0 a through BZ7 a. All base cycles of overallcycle GZ2 have the same structure. These base cycles can be composedselectively from exclusive (A through F) and arbitrating components. Thetotal number of lines (thus base cycles BZ0 a through BZ7 a) here is anumber 2^(m)=8, where m=3.

[0047] One base cycle (line of the transmission matrix) begins with areference mark in reference message RN and is composed of a plurality(i) of successive timing windows of defined length (first timing windowZFO, i.e., ZFRN for RN). The arrangement of the messages within the basecycle can be freely established. A timing window is linked for exclusivecomponents to a CAN message object. A timing window can also be leftfree (409, 421, 441, 417, 445) or be used for arbitrating components(403, 427).

[0048] Messages which are always sent in the same timing window but indifferent base cycles form a transmission group (column of thetransmission matrix, A through F) (see FIG. 4). Consequently, a periodcan be established, e.g., A in ZF1 a and ZF4 a: 401, 407, 413, 419, 425,431, 437, 443 and 404, 410, 416, 422, 428, 434, 440, 446. One messageobject (of a timing window) can be sent repeatedly within a transmissiongroup. The period of a message within a transmission group is a number2, where 1←= m.

[0049] The message object, i.e., the message, corresponds to the messageobject of the bus, particularly in CAN, and includes the identifier, aswell as the data itself. In TTCAN, the message object is supplemented byat least one, preferably by all three, of the following entries in thetransmission matrix: timing window, base mark, rate of repetition.

[0050] The timing window is the position (ZF0, ZF1 a through ZF5 a) inthe base cycle (BZn, line of the transmission matrix). The beginning ofthe timing window is defined by reaching a specific timing mark.

[0051] The base mark indicates in which base cycle (BZ0 a through BZ7 a)in the overall cycle the message is sent first. The rate of repetitiondefines after how many base cycles this transmission is repeated.

[0052] To indicate the validity of a message object for the CANcontroller, there is a “permanent transmission request” which signifiesa permanent enabling of the object (for exclusive components, see below)and an “individual transmission request” which signifies a one-timevalidity of the object (for arbitrating components, see below).

[0053] The automatic retransmission from CAN is advantageouslydeactivated for the messages in TTCAN.

[0054] In the following, the message transfer—periodic messages andspontaneous messages—in the base cycle or in the overall cycle,particularly with respect to the application, is now described again. Inso doing, exclusive messages, thus periodic messages, and arbitrating,thus spontaneous messages, are again differentiated.

[0055] Exclusive Message Objects (Periodic Messages):

[0056] Exclusive message objects are sent when the application watchdogis set, the “permanent transmission request” of the application is setat the CAN controller, and the transmission enabling interval of theappertaining timing window is open. In this case, the timing mark forthe message object agrees with the relative time. The permanenttransmission request remains set until it is reset by the applicationitself.

[0057] Arbitrating Message Objects (Spontaneous Messages):

[0058] Arbitrating message objects are sent when the applicationwatchdog is set, the “individual transmission request” of theapplication is set at the CAN controller, and the transmission enablinginterval of the next timing window specified for this is open. Thetiming mark for this timing window is then equal to the relative time.The transmission request is reset after successful transmission by theCAN controller. The simultaneous access of various spontaneous messagesis regulated via the bit arbitration of CAN. If a spontaneous message inthis timing window loses versus another spontaneous message, then it canfirst fight again for bus access in the next timing window specified forthis.

[0059] If the entire transmission matrix, i.e. the overall cycle is runthrough, then a cyclical, time-controlled message transmission isyielded. Time-controlled means that each action uses, as a point ofdeparture, the attainment of a specific instant (see timing marks andrelative time). If the overall cycle is run through completely, i.e.,all base cycles were processed once, then a start is made again with thefirst base cycle of the transmission matrix. No time gaps arise in thetransition. An overview of such a time-controlled communications systemwith timer has been presented in the description and the figures of theDrawing.

[0060] By analogy with FIG. 1, FIG. 5 shows a system having users and abus system. In this context, a time drift of local times or time basesis determined in a base cycle n beginning at instant tn. The driftcorrection is then effected in the following base cycle n+1 beginningwith tn+1. The times or time bases are then corrected in the next basecycle n+2 beginning with tn+2.

[0061]FIG. 6 now shows in detail a drift correction according to thepresent invention. Each node (TTCAN controller) includes:

[0062] a local oscillator which, together with a counter, indicates thelocal time;

[0063] a reference marker in which the local time is buffered uponreception of a reference message. The reference marker is advantageouslydesigned as a double FIFO;

[0064] a local offset register (double FIFO) which contains thedifference between the local reference mark and the timer referencemark;

[0065] an offset difference register which contains the difference ofthe last two offsets;

[0066] a drift-correction-value register which contains the correctionvalue with which the local timer is subsequently corrected;

[0067] a correction-period register.

[0068] In a TTCAN system, each base cycle is started with a referencemessage in which a time reference is stipulated, and each nodedetermines the interval of its local time with respect to thisreference.

[0069] A local deviation is calculated from the difference of theintervals of two base cycles and placed in relationship to the totaltime, from which a basic correction value is calculated for the localtime. This basic correction value can be refined, in that for eachfurther base cycle, the difference of the local deviation is also usedfor the correction.

[0070] For simple conversion of the algorithm in hardware or software,the usually necessary quotient formation can be replaced during acorrection period (base cycle) by an examination as to how often thecorrection value is contained in the correction period. This can bedone, for example, by a repeated subtraction of the correction valuefrom the correction period in a suitable register, until the residualamount is smaller than the subtrahend. Thereupon, an additional countingpulse is inserted or left out depending on the preceding sign of thecorrection-value change. The difference between the last two localreference marks is added to the remaining residual amount.

[0071] Thus, when working with a steady-state system, a synchronizationto +/− one bit time over a base cycle is possible.

[0072] The terms time-reference message and reference message aresynonymous.

What is claimed is:
 1. A method for an exchange of data in messagesbetween at least two users connected by a bus system and having separatetime bases, comprising the steps of: causing the at least two users totransmit data via the bus system in the messages; causing a first one ofthe at least two users, in a function as timer, to control the messagesas a function of time such that the first one of the at least two usersrepeatedly transmits a reference message including a first timeinformation regarding a time base of the first one of the at least twousers, via the bus system at a specifiable time interval; causing atleast a second one of the at least two users to form a second timeinformation in accordance with a time base of the at least second one ofthe at least two users, as a function of the first time information;ascertaining a correction value from the first time information and thesecond time information; and causing the at least second one of the atleast two users to adapt as a function of the correction value at leastone of the second time information and the time base of the at leastsecond one of the at least two users.
 2. The method according to claim 1, further comprising the steps of: subdividing the specifiable timeinterval into timing windows of a specifiable length; and transmittingthe messages including the data in the timing windows.
 3. The methodaccording to claim 2 , further comprising the step of: combining thereference message and subsequent ones of the timing windows up to a nextreference message to form a first cycle of at least one of thespecifiable length and a specifiable structure, wherein: the specifiablestructure corresponds to the specifiable length, number, and timeposition of the timing windows in the specifiable time intervalfollowing the reference message.
 4. The method according to claim 3 ,further comprising the steps of: combining a plurality of first cyclesof a same specifiable structure to form a second cycle; and repeatedlytransmitting messages in the second cycle in timing windows having atime interval greater than a time length of the first cycle.
 5. Themethod according to claim 3 , further comprising the steps of: startingeach first cycle with the reference message; and causing the at leastsecond one of the at least two users to determine an interval of thetime base of the at least second one of the at least two users withrespect to the time base of the first one of the at least two users. 6.The method according to claim 1 , further comprising the step of:ascertaining the correction value from a difference of the specifiabletime interval of the first one of the at least two users and anothertime interval of the at least second one of the at least two users. 7.The method according to claim 1 , further comprising the steps of:omitting a cyclical message transfer in at least one timing window ofone of a first cycle and a second cycle; and transmitting arbitratingmessages in the at least one timing window.
 8. A device for an exchangeof data in messages between at least two users connected by a bus systemand having separate time bases, comprising: an arrangement for causingthe at least two users to transmit data via the bus system in themessages; an arrangement for causing a first one of the at least twousers, in a function as timer, to control the messages as a function oftime such that the first one of the at least two users repeatedlytransmits a reference message including a first time informationregarding a time base of the first one of the at least two users, viathe bus system at a specifiable time interval; an arrangement forcausing at least a second one of the at least two users to form a secondtime information in accordance with a time base of the at least secondone of the at least two users, as a function of the first timeinformation; an arrangement for ascertaining a correction value from thefirst time information and the second time information; and anarrangement for causing the at least second one of the at least twousers to adapt as a function of the correction value at least one of thesecond time information and the time base of the at least second one ofthe at least two users.